<?php
class KVCache_Demo extends KVCache{

	protected 	$cache_name = 'demo';	//cache name 唯一
	protected	$expire = 10;			//超時時間

	/** 創建cache內容 */	
	function create_cache_content($key){		
		$data = db_query('demo',array('order'=>'addtime desc'));
		return $data['result'];
	}

	/** 格式化cache內容 */
	function post_format($key, $value){
		foreach($value as $key=>$val){
			$value[$key]['gender'] = $this->showgender($value[$key]['gender']);
			$value[$key]['addtime'] = $this->showdate($value[$key]['addtime']);
			$value[$key]['lastmodtime'] = $this->showdate($value[$key]['lastmodtime']);
		}
		return $value;
	}
	
	function showgender($gender){
		return $gender==1? '男' : '女';
	}
	
	function showdate($date){
		$dt = strtotime($date);
		return date('Y年m月d日 H時i分s秒',$dt);
	}
}
?>